import threading
import time
from plugins.linux import uptime
from plugins.linux import loadavg
from tools import config
from tools import parser

class AlertThread (threading.Thread):
	"""Checks the plugins alert values."""
	
	def __init__ (self) :
		""" """
		threading.Thread.__init__ (self)
		self.plugins=config.getAllPlugins()
	
	def run (self) :
		"""Infinite loop"""
		while 1 :
			for plugin in self.plugins :
				if eval (plugin+".getAlert()") :
					parser.sendalert(plugin)
			time.sleep (config.getAlertCheckTime())

